<!-- 告警底部 -->

<template>
  <div v-if="one.alarmResolveState === 1" class="DetailAlarm-AlarmFooter">
    <BtnPrimary v-for="[id, name] in btnDict" :key="id" :title="name" @click="openDeal(one, id)" />
  </div>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'AlarmFooter',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb(), CORE.mixWeb('deal', 'deal_')],

  /**
   * 计算属性 (慎用箭头函数)
   */
  computed: {
    /**
     * 按钮字典
     */
    btnDict() {
      return CORE.DICT.ALARM_DEAL_TYPE.filter((item) => !item[5]())
    },
  },

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: {
    /**
     * 打开处理弹窗
     */
    openDeal(one, type) {
      const [id, operate] = CORE.DICT.ALARM_DEAL_TYPE.find(([id]) => id === type) || []
      this.setOne(one)
      this.deal_openEdit({ id: one.id, dealType: +id, operate })
    },
  },
}
</script>
